﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Chinesys.Entities;

namespace Chinesys.Domain.InputValidations
{
    public class ProductInputValidation : InputValidationBase
    {
        private ProductEntity product;

        public ProductInputValidation(ProductEntity prod)
        {
            this.product = prod;
        }

        public override void Validate()
        {
            if (product.CategoryId == 0)
            {
                Errors.Add(new Required("Category"));
            }

            if (product.SubCategoryId == 0)
            {
                Errors.Add(new Required("SubCategory"));
            }

            if (product.Price == 0)
            {
                Errors.Add(new Required("Price"));
            }

            if (string.IsNullOrEmpty(product.Description))
            {
                Errors.Add(new Required("Description"));
            }

            if (string.IsNullOrEmpty(product.ImageSrc))
            {
                Errors.Add(new Required("Image"));
            }
        }
    }
}
